#!/bin/sh

mount -t proc none /proc
mount -t sysfs none /sys
mount -t rootfs -o remount,rw rootfs /

mount -t devtmpfs devtmpfs /dev 2>/dev/null

# got a kernel panic in dpup stretch with debian kernel 4.9
# this solved the issue
sleep 0.5

# this is not required for huge kernels and actually fails
# but it's needed by other type of kernels for the usb stuff to work
mkdir -p /proc/bus/usb 2>/dev/null
mount -t usbfs none /proc/bus/usb 2>/dev/null

ln -s /proc/mounts /etc/mtab 2>/dev/null

# loop1-15
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
	[ -e /dev/loop${i} ] && continue
	mknod /dev/loop${i} b 7 $i
done

# busybox 1.25 losetup somehow requires /dev/loop/X in the initrd to work..
# edit: only if CONFIG_FEATURE_DEVFS is enabled

### END ###
